
// pages/components/five-line-view/five-line-view.js
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    itemData: Object,
  },

  /**
   * 组件的初始数据
   */
  data: {
    title: '',
    percent: 0,
    colorA: 0,
    colorB: 0,
    colorC: 0,
    color: '',
  },

  observers: {
    'itemData'(itemData) {
      this.updateData()
    }
  },

  lifetimes: {
    attached() {
      this.updateData()
    },

    ready: function() {
    },

    moved: function() {
    },
    
    detached: function() {
    },
  },

  /**
   * 组件的方法列表
   */
  methods: {
    updateData: function() {
      let tempTitle = this.properties.itemData.title;
      let tempPercent = this.properties.itemData.percent;
      let tempColorA = this.properties.itemData.colorA;
      let tempColorB = this.properties.itemData.colorB;
      let tempColorC = this.properties.itemData.colorC;
      this.setData({
        title: tempTitle,
        percent: tempPercent,
        colorA: tempColorA,
        colorB: tempColorB,
        colorC: tempColorC,
        color: "rgb("+ tempColorA + ',' + tempColorB + ',' + tempColorC + ')',
      })
    },

  }
})